<script setup>
import { useFetch } from "./fetch.js";

const { data, error } = useFetch("https://jsonplaceholder.typicode.com/todos/2");
</script>
<template>
  <div v-if="error">Oops! Error encountered: {{ error.message }}</div>
  <div v-else-if="data">
    Data loaded:
    <pre>{{ data }}</pre>
  </div>
  <div v-else>Loading...</div>
</template>